//获取应用实例
const app = getApp()
Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
  },

  // onShow: function () {
  //   app.globalData.email=''
  // }

  inputip: function (e) {
    app.globalData.email= e.detail.value
  },

  bindtest: function () {
    if (app.globalData.email != ''){
      wx.request({
        url: 'https://hi.slickghost.com/WebTest/Operate',
          data: {
            choice:'insertemail',
            openid: app.globalData.openid,
            email: app.globalData.email
          },
          header: {
            'content-type': 'json'
          },
          success: function () {
            wx.showToast({
                title: '邮箱绑定成功！',
                icon: 'success',
                duration: 1000
            })
          }
      })
    }else{
      wx.showModal({
        title: '提示',
        content: '邮箱为空',
        success: function () {
        }
      })
    }
  }
})
